This file is a Mathematica notebook that gives some examples of what Mathematica can do. For information on how to read this notebook, see the file Read This First!
This file is loosely based on the “Tour of Mathematica” in Mathematica: A System for Doing Mathematics by Computer, Second Edition, by Stephen Wolfram. This book was published by Addison-Wesley in 1991, and is available at most bookstores. For information on how to obtain copies of Mathematica itself, see the section “Buying Mathematica ” in the file Read This First!
The first line here is what you type into Mathematica. The second line is the result Mathematica gives. If you are reading this notebook on a color system, the input and output are blue, with the input in boldface.
Many integrals do not have a “closed form solution”. If you give Mathematica such a definite integral it will be returned unevaluated. You can still use N to get a numerical answer.
Mathematica can also solve differential equations. Here is a pair of simultaneous differential equations. The solution you get involves two undetermined coefficients.
It is a mathematical fact that most differential equations do not have an explicit symbolic solution. In these cases you can get a numerical approximation to the solution using NDSolve. After the solution is computed it is plotted.
It is a fact of mathematics that there is no way to get an exact formula for the solutions of a quintic equation like this. You can nevertheless ask Mathematica to give you numerical results. You get the five complex number roots to the equation.
When equations contain complicated functions there is in general no systematic procedure for finding all solutions, even numerically. The Mathematica function FindRoot searches for a numerical solution to an equation, starting at a specified point.
Mathematica generates all graphics in PostScript, so that you can resize pictures, and make use of the resolution available on different types of printers. (Note, however, that to save disk space the graphics in this notebook have been converted into bitmap images, which have lower resolution and do not look as good when resized or printed. The ability to convert images into bitmap form is useful when space is at a premium, and for animations, which are normally not printed.)
This notebook contains a sample of animation in Mathematica. Due to disk space limitations, this is a simple black and white example. Look at the Color Movie notebook on your disk for an example of animated color graphics.
To play a sound, double-click the small, speaker-shaped icon at the top of the sound cell bracket. Note: When you double-click the sound cell itself, Mathematica treats it as an animated graphic and plays it repeatedly. To stop, click again anywhere.
This loads in a package that defines properties of polyhedra.
The package defines, among other things, the geometry of a dodecahedron. The Vertices function gives the coordinates for the faces of the given polyhedron.
Here are the vertices for a dodecahedron shown in shortened form.
As another example, we can use the definitions from the polyhedra package to create an image of a stellated icosahedron, which is often used as an icon for the Mathematica system.
There are several styles of programming in Mathematica. One of them is procedural programming, as you would find in a standard structured programming language such as C or Pascal.
Another is “rule-based programming”. The idea is to give transformation rules which specify how Mathematica should transform expressions it receives as input.
You can give rules that mimic the formulas you might find in a mathematics textbook.
Here is an example of how you might teach Mathematica about a new form of logarithm function, called nlog.
Another style of programming you can use in Mathematica is functional programming. In functional programming, you specify a collection of functions to apply. This style of programming often yields compact, elegant programs that make good use of Mathematica's many integrated capabilities.
Mathematica consists of two parts — the “kernel”, which actually does computations, and the “front end”, which deals with interaction with the user. The kernel of Mathematica is essentially the same on all computers that support Mathematica. The front end, on the other hand, works differently on different kinds of computer.
On the Macintosh, Mathematica has a sophisticated front end that takes advantage of the Macintosh's unique user interface capabilities. (You can actually use the Macintosh front end even if you are using a “remote kernel”, say on a supercomputer connected through a network.)
One of the most important aspects of the Macintosh front end is its ability to support Mathematica “notebooks”.
This file is an example of a notebook. Notebooks consist of a mixture of text, graphics, sounds and Mathematica input.
Notebooks can be used like “interactive textbooks” — you read the text in the notebook, then use the Mathematica input in the notebook to perform calculations.